#!/bin/sh


if [ $# -gt 0 -a -d ../branches/$1 ] 
then
	cd ../branches/$1
	mv installer.po ../installer.po.$1
	msgcat --use-first --no-wrap *.po ../installer.po.$1 | msgattrib --no-obsolete --no-wrap -o ../compendium.po
	msgmerge --no-wrap --force-po ../installer.po.$1 /dev/null | msgattrib --no-obsolete --force-po --no-wrap -o installer.po
	msgmerge --compendium=../compendium.po --no-wrap -o installer.po installer.po ../installer.po.$1 ;
	rm ../compendium.po ../installer.po.$1
	echo "The file 'installer.po' has been updated." ;
else
	echo "The branch '$1' does not exist. A valid branch must be specified."
	echo "Usage: ./update-installer-po.sh [BRANCH]."
fi